{% extends 'public/base.html' %}
{% block 'con' %}
<!-- 内容区域 -->
    <div class="tpl-content-wrapper">

        <div class="container-fluid am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                    <div class="page-header-heading">
                        <span class="am-icon-user page-header-heading-icon"></span> 用户列表
                    </div>
                </div>
            </div>
        </div>
        
        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        
                        <div class="widget-body  am-fr">

                            <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                                <div class="am-form-group">
                                    <div class="am-btn-toolbar">
                                        <div class="am-btn-group am-btn-group-xs">
                                            <button type="button" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span> 新增</button>
                                            <button type="button" class="am-btn am-btn-default am-btn-secondary"><span class="am-icon-save"></span> 保存</button>
                                            <button type="button" class="am-btn am-btn-default am-btn-warning"><span class="am-icon-archive"></span> 审核</button>
                                            <button type="button" class="am-btn am-btn-default am-btn-danger"><span class="am-icon-trash-o"></span> 删除</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
			
			<form action="" method="">
                            <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                                <div class="am-form-group tpl-table-list-select">
                                    <select name="type" data-am-selected="{btnSize: 'sm'}" style="display: none;">
                                        <option value="username" {% if request.GET.type == 'username' %} selected {% endif %}>用户名</option>
                                        <option value="sex" {% if request.GET.type == 'sex' %} selected {% endif %}>性别</option>
                                        <option value="status" {% if request.GET.type == 'status' %} selected {% endif %}>状态</option>
                                        
                                    </select>
                                    
                                </div>

                            </div>

                            <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
                            	<div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                            	    <input name="keywords" type="text" class="am-form-field" value="{{ request.GET.keywords }}">
                            	    <span class="am-input-group-btn">
                                    <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search"></button>
                            	</span>
                        	</div>
                    	    </div>
			</form>
                            <div class="am-u-sm-12">
                                <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black " >
                                    <thead>
                                        <tr>
                                            <th>头像</th>
                                            <th>ID</th>
                                            <th>用户名</th>
                                            <th>邮箱</th>
			                                <th>性别</th>
                                            <th>年龄</th>
                                            <th>添加时间</th>
				                            <th>状态</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        {% for v in users %}
                                        <tr class="">
                                            <td class="am-text-middle"> 
                                                <img src="{{ v.pic }}" class="tpl-table-line-img" alt="">
                                            </td>
                                            <td class="am-text-middle">{{ v.id }}</td>
                                            <td class="am-text-middle"> {{ v.username }}</td>
                                            <td class="am-text-middle"> {{ v.email }}</td>
			                                <td class="am-text-middle"> 
                                                {% if v.sex == '0' %}
                                                    男
                                                {% else %}
                                                    女
                                                {% endif %}
                                            </td>
                                            <td class="am-text-middle"> {{ v.age }}</td>
                                            <td class="am-text-middle"> {{ v.addtime }}</td>
                                            <td class="am-text-middle"> 
                                                <!-- {{ v.status }} -->
                                                {% if v.status == 'a' %}
                                                    普通会员

                                                {% elif v.status == 'b' %}
                                                    管理者

                                                {% else %}
                                                    已禁用

                                                {% endif %}

                                            </td>
                                            <td class="am-text-middle">
                                                <div class="tpl-table-black-operation ">
                                                    <a href="{% url 'useredit' v.id %}">
                                                        <i class="am-icon-pencil"></i> 编辑
                                                    </a>
                                                    <a href="{% url 'userdel' v.id %}" class="tpl-table-black-operation-del">
                                                        <i class="am-icon-trash"></i> 删除
                                                    </a>
                                                </div>
                                            </td>
                                        </tr>
                                        {% endfor %}

                                        
                                        <!-- more data -->
                                    </tbody>
                                </table>
                            </div>

                            {% load pagetag %}
                            <div class="am-u-lg-12 am-cf">

                                <div class="am-fr">
                                    <ul class="am-pagination tpl-pagination">
                                        <!-- 
					  users是一个对象,里面不仅包含当前页面数据,还有总数据
                                          总页数 users.paginator.num_pages
                                	  当前页 request.GET.p

                                        -->
   					                    {% load pagetag %}
					
                                        {% PageShow users.paginator.num_pages request %}




                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>





    </div>

{% endblock %}
